#pragma once
#ifndef __NEZHAIREADFILE_H__
#define __NEZHAIREADFILE_H__

#include "NezhaRefable.h"

namespace Nezha
{
	namespace stream
	{

		class IReadFile;

		typedef void (*Callback)(int result, int error, IReadFile* reader, void* arg);

		class FOUNDATION_ENTRY IReadFile : public Refable
		{
		public:

			virtual int read(void* buffer, u32 sizeToRead) = 0;

			virtual bool readAsync(void* buffer, u32 sizeToRead, Callback callback, void* arg) = 0;

			virtual bool readAsync(void* buffer, u32 sizeToRead, long finalPos, Callback callback, void* arg) = 0;

			virtual bool seek(long finalPos, bool relativeMovement = false) = 0;

			virtual IReadFile* clone(bool keepPos = true) const = 0;

			virtual long getSize() const = 0;

			virtual long getPos() const = 0;

			virtual const char* getFileName() const = 0;

			virtual const char* getFullPath() const = 0;

			virtual void* getBuffer(long* size)
			{
				return 0;
			}

			virtual void* getExternalBuffer(const char* filename, long* size)
			{
				return 0;
			}

			virtual bool isAllInMemory() const
			{
				return false;
			}

			bool isReading()
			{
				return bReading;
			}


		protected:
			bool bReading;
		}; // class NezhaIReadFile 
	};
};

#endif // __NEZHAIREADFILE_H__